import { createElement, createTextVNode } from "./vdom/vnode"

export function renderMixin (Vue) {
  Vue.prototype._render = function () {
    const vm = this
    const render = vm.$options.render
    const vnode = render.call(vm)
    return vnode
  }

  Vue.prototype._c = function () {
    return createElement(...arguments)
  }

  Vue.prototype._v = function (text) {
    return createTextVNode(text)
  }

  Vue.prototype._s = function (val) {
    return val == null
      ? ''
      : typeof val === 'object'
        ? JSON.stringify(val)
        : val
  }
}